/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.dataprocessing.controller;

import com.icinfo.cloud.provider.punish.dataprocessing.dto.*;
import com.icinfo.cloud.provider.punish.dataprocessing.service.IDataProcessCaseInfoOperationRecordService;
import com.icinfo.cloud.provider.punish.dataprocessing.vo.*;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 描述: 工单处理-操作日志表 data_process_case_info_operation_record 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2023年02月02日
 */
@RestController
@RequestMapping("/dataProcess")
public class DataProcessCaseInfoOperationRecordController extends BaseController {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(DataProcessCaseInfoOperationRecordController.class);

    @Autowired
    private IDataProcessCaseInfoOperationRecordService operationRecordService;

    /**
     * 描述： 搜索 案件/案源 信息
     *
     * @param searchDto 搜索对象
     * @return 案件/案源信息
     * @author lilihao
     * @date 2023/2/3 11:26
     */
    @PostMapping("/searchCaseInfo")
    public Result<List<DataProcessCaseInfoVo>> searchCaseInfo(@RequestBody @Validated CaseSearchDto searchDto) {
        List<DataProcessCaseInfoVo> caseInfoVo = operationRecordService.searchCaseInfo(searchDto);
        return Result.success(caseInfoVo);
    }

    /**
     * 获取操作列表
     *
     * @param
     * @return
     * @author lilihao
     * @date 2023/2/3 16:22
     */
    @PostMapping("/getOperationList")
    public Result<List<DataProcessOperationRecordVo>> getOperationList(@RequestBody @Validated DataProcessCaseDetailDto detailDto) {
        List<DataProcessOperationRecordVo> operationList = operationRecordService.getOperationList(detailDto);
        return Result.success(operationList);
    }

    /**
     * 获取文书列表
     *
     * @param
     * @return
     * @author lilihao
     * @date 2023/2/3 16:22
     */
    @PostMapping("/getCaseDocList")
    public Result<List<DataProcessCaseDocListVo>> getCaseDocList(@RequestBody @Validated DataProcessCaseDetailDto detailDto) {
        List<DataProcessCaseDocListVo> caseDocList = operationRecordService.getCaseDocList(detailDto);
        return Result.success(caseDocList);
    }

    /**
     * 获取预览文书url
     *
     * @param detailDto 详情内容
     * @return
     * @author lilihao
     * @date 2023/2/3 16:22
     */
    @PostMapping("/getPreviewDocUrl")
    public Result<String> getPreviewDocUrl(@RequestBody @Validated DataProcessCaseDetailDto detailDto) {
        String previewDocUrl = operationRecordService.getPreviewDocUrl(detailDto);
        return Result.success("操作成功！", previewDocUrl);
    }

    /**
     * 修改文书
     *
     * @param modifyDto 修改对象
     * @author lilihao
     * @date 2023/2/3 16:22
     */
    @PostMapping("/modifyCaseDoc")
    public Result modifyCaseDoc(@RequestBody @Validated DataProcessDocModifyDto modifyDto) {
        return operationRecordService.modifyCaseDoc(modifyDto);
    }

    /**
     * 获取字段列表
     *
     * @param
     * @return
     * @author lilihao
     * @date 2023/2/3 16:22
     */
    @PostMapping("/getCaseFieldList")
    public Result<List<DataProcessCaseFieldListVo>> getCaseFieldList(@RequestBody @Validated DataProcessCaseDetailDto detailDto) {
        List<DataProcessCaseFieldListVo> caseFieldList = operationRecordService.getCaseFieldList(detailDto);
        return Result.success(caseFieldList);
    }

    /**
     * 修改字段
     *
     * @param modifyDto 修改对象
     * @author lilihao
     * @date 2023/2/3 16:22
     */
    @PostMapping("/modifyCaseFiled")
    public Result modifyCaseFiled(@RequestBody @Validated DataProcessFiledModifyDto modifyDto) {
        return operationRecordService.modifyCaseFiled(modifyDto);
    }

    /**
     * 删除案件/案源
     *
     * @param deleteDto 删除对象
     * @author lilihao
     * @date 2023/2/3 16:22
     */
    @PostMapping("/deleteCase")
    public Result deleteCase(@RequestBody @Validated DataProcessDeleteDto deleteDto) {
        return operationRecordService.deleteCase(deleteDto);
    }

}